package main

import "fmt"

// type定义类型  可以起别名
type myint int

// Book大写外部可访问  book内的属性首字母小写  方法名小写都是外部不能访问的
type Book struct {
	name   string
	author string
}

func changeBook(book Book) {
	book.name = "changed" + book.name
}

func changeBookByPoint(book *Book) {
	// 注意  这里直接用指针就行  不用写成 *book.name = ...
	book.name = "changed" + book.name
}

func main9() {
	var i myint = 10
	fmt.Println("a is %s, and type of a is T%", i, i)
	// 变量赋值
	var book Book
	book.name = "c"
	book.author = "beier"
	fmt.Println(book)

	// 默认赋值
	book1 := Book{
		"Golang",
		"zhangsan",
	}
	fmt.Println(book1)

	changeBook(book1)

	fmt.Println(book1)

	changeBookByPoint(&book1)

	fmt.Println(book1)

}
